package com.ckr.controller;

import com.ckr.mapper.UserMapper;
import com.ckr.pojo.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Shadowckr
 * @create 2022-01-15 22:04
 */

@RestController
public class UserController {
    @Resource
    UserMapper userMapper;

    // 获取所有用户信息
    @GetMapping("/getUsers")
    public List<User> getUsers() {
        return userMapper.getUsers();
    }

    // 通过id获得用户
    @GetMapping("/getUserById/{id}")
    public User getUserById(@PathVariable("id") Integer id) {
        return userMapper.getUserById(id);
    }
}
